<template>
  <div class='container'>
    <el-card class="filter-container" shadow="never">
      <div>
        <i class="el-icon-search"></i>
        <span>筛选搜索</span>
        <el-button
          style="float:right"
          type="primary"
          size="small"
          @click="search_button()">
          查询搜索
        </el-button>
        <el-button
          style="float:right;margin-right: 15px"
          size="small"
          @click="reset_button()">
          重置
        </el-button>
      </div>
      <div style="margin-top: 15px">
        <el-form :inline="true"  size="small" label-width="140px">
          <el-form-item label="输入搜索：">
            <el-input  class="input-width" v-model="keyword_value" placeholder="收入" clearable></el-input>
          </el-form-item>
        </el-form>
      </div>
    </el-card>
    <el-card class="operate-container" shadow="never">
      <i class="el-icon-tickets"></i>
      <span>收入列表</span>
    </el-card>
    <div class='table-container'>
      <el-table
        class='m-30-t'
        :data="shop_account_log_list"
        fit
        @select="chosen_option"
        @select-all="all_options"
        v-loading="listLoading"
        stripe
        border
        highlight-current-row>
        <el-table-column type="selection" ></el-table-column>
        <el-table-column
          prop="id"
          label="id"
          align="left">
        </el-table-column>
        <el-table-column
          prop="amount"
          label="数额"
          align="center">
        </el-table-column>
        <el-table-column
          prop="source_id"
          label="源订单id"
          align="center">
        </el-table-column>



        <el-table-column
          prop="note"
          label="备注"
          align="center">
        </el-table-column>
        <el-table-column
          prop="ctime"
          label="创建日期"
          align="center">
        </el-table-column>

      </el-table>
    </div>
    <div class="pagination-container m-50-t m-50-b">
      <span></span>
      <el-pagination
        background
        @size-change="size_change"
        @current-change="current_change"
        layout="total, sizes,prev, pager, next,jumper"
        :current-page.sync="page_num"
        :page-size="page_size"
        :page-sizes="page_sizes"
        :total="total">
      </el-pagination>
    </div>

  </div>
</template>

<script>
  import shop_account_log_request from "@/api/shop_account_log_request"
  export default {
    name: 'shop_account_log_list',
    data() {
      return {
        detail_data: {},
        shop_account_log_list: [],
        dialog_visible: false,
        isEdit: false,
        search_value: '',
        page_num: 1,
        page_size: 10,
        page_sizes: [5,10,15],
        total: null,
        keyword: '',
        keyword_value: '',
        current_size: 10,
        listLoading: false,
        current_page: 1,
      }
    },
    created() {
      this.get_list(this.$route.query.id)
    },
    mounted() {
  
    },
    methods: {
      // 搜索
      search_button() {
        this.current_page = 1
        this.keyword = this.keyword_value
        this.filter_list()
      },
      // 重置
      reset_button() {
        this.keyword = '' 
        this.keyword_value= ''
        this.get_list()
      },

      chosen_option(id_list) {
        this.delete_list = id_list
      },
      all_options(id_list) {
        this.delete_list = id_list
      },

      // 详情
      detail_button(id) {
        shop_account_log_request.detail_shop_account_log({id}, res=> {
          this.detail_data = res.data
        })
        this.detail_dialog_visible = true
      },
      size_change(current_size) {
        this.current_size = current_size
        this.get_list()
      },
      current_change(current_page) {
        this.current_page = current_page
        this.get_list()
      },
      filter_list() {
        shop_account_log_request.shop_account_log_list({pageSize: 1000000000, key: this.keyword}, res=> {
          this.shop_account_log_list = res.data
          this.total = res.data.length
        })    
      },
      get_list(shop_id) {
        this.listLoading = true,
        shop_account_log_request.shop_account_log_list({pageSize: this.current_size, page: this.current_page, key: this.keyword,shop_id}, res=> {
          this.listLoading = false,
          this.shop_account_log_list = res.data
          this.total = res.totalRecord
        })
      },

    }
  }
</script>

<style scoped>
@import "~@/styles/layout.scss";
.table-container {
  margin-left: 30px;
}
.pagination-container {
  float: right;
}
.good-img {
  width: 100px;
  height:100px;
}
</style>